import { Controller, Get, SetMetadata } from '@nestjs/common';
import { AppService } from './app.service';
import { RequireLogin, UserInfo } from "./custom.decorator";

@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Get()
  getHello(): string {
    return this.appService.getHello();
  }

  @Get("aaa")
  @SetMetadata("require-login", true)
  @SetMetadata("require-permission", ["ccc"])
  aaa() {
    return "aaa"
  }

  @Get("bbb")
  @RequireLogin()
  bbb(@UserInfo("username") username: string, @UserInfo() userInfo: any) {
    console.log("username", username);
    console.log("userInfo", userInfo);
    return "bbb"
  }
}
